package com.example.mobile2021606170hsy0406homework;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import androidx.appcompat.app.AppCompatActivity;

public class Main8Activity extends AppCompatActivity {

    private TextView tvMainTitle;
    private TextView tvMainJadge;
    private TextView tvMainAskfor;
    private TextView tvMainInteger;
    private EditText edtTxtMainInteger;
    private Button btMainDispose;
    private EditText edtTxtMainResult;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main8);
        initView();
    }

    private void initView() {
        tvMainTitle = findViewById(R.id.tv_main_title);
        tvMainJadge = findViewById(R.id.tv_main_jadge);
        tvMainAskfor = findViewById(R.id.tv_main_askfor);
        tvMainInteger = findViewById(R.id.tv_main_integer);
        edtTxtMainInteger = findViewById(R.id.edtTxt_main_integer);
        btMainDispose = findViewById(R.id.bt_main_dispose);
        edtTxtMainResult = findViewById(R.id.edtTxt_main_result);
    }
    public  void  dealonClik(View view){
        String a =edtTxtMainInteger.getText().toString();
        if (a.length() ==0) {
            Toast.makeText(Main8Activity.this, "请输入数字", Toast.LENGTH_SHORT).show();
        }else {
            edtTxtMainResult.setText(String.valueOf(a.length()));
            int b = Integer.parseInt(a);
            edtTxtMainResult.setText(String.valueOf(b)+" ");
            StringBuffer num = new StringBuffer(String.valueOf(b));
            edtTxtMainResult.setText(num.reverse());
        }
    }
}
